/*
 * @Author: GL
 * @Date: 2022-09-20 17:04:32
 * @LastEditors: GL
 * @LastEditTime: 2022-10-04 19:05:47
 * @Description: des
 */
import { createRouter, createWebHistory } from 'vue-router'
import login from '../views/login.vue'

const routes = [
  {
    path:'/',
    redirect:'/login'
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/register',
    name: 'register',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/register.vue')
  },
  {
    path:'/home',
    name:'home',
    component: () => import('../views/home.vue'),
    redirect: '/home/product',
    children: [
      // 当 /user/:id 匹配成功
      // UserHome 将被渲染到 User 的 <router-view> 内部
      { 
        path: 'product',
        component: () => import('../components/travel/product.vue'),
      },
      {
        path:'report',
        component: () => import('../components/report/index.vue')
      },
      {
        path:'session',
        component: () => import('../components/travel/session.vue')
      },
      {
        path:'scenic',
        component: () => import('../components/travel/scenic.vue')
      },
      {
        path:'equipment',
        component:() => import('../components/travel/equipment.vue')
      },
      {
        path: 'system',
        component: () => import('../components/system/index.vue')
      },
      {
        path:'content',
        component: () => import('../components/content/index.vue')
      },
      {
        path:'profile',
        component: () => import('../components/profile/index.vue')
      }

      // ...其他子路由
    ],
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
